<?php

namespace app\admin\controller\system;

use app\admin\controller\AuthController;
use app\model\system\SystemAdmin;
use app\model\system\SystemLog;
use albert\services\UtilService;
use Exception;

/**
 * 管理员操作记录表控制器
 * Class LogController
 * @package app\admin\controller\system
 */
class LogController extends AuthController
{
    /**
     * 显示操作记录
     * @throws Exception
     */
    public function index(): string
    {
        SystemLog::deleteLog();
        $where = UtilService::param([
            ['pages', ''],
            ['path', ''],
            ['ip', ''],
            ['admin_id', ''],
            ['data', ''],
        ], $this->request);
        $where['level'] = $this->admin['level'];
        $this->assign('where', $where);
        $this->assign('admin', SystemAdmin::getOrdAdmin('id,nickname', $this->admin['level']));
        $this->assign(SystemLog::systemPage($where));
        return $this->fetch('system/log');
    }
}
